-- SmallBuilding
-- Create by weism
-- 小物件对象

SmallBuilding = {
    x = 0,
    y = 0,
};
SmallBuilding.__index = SmallBuilding;

-- 构造函数
function SmallBuilding.new(dbase)
    local self = {};
    setmetatable(self, SmallBuilding);
    
    -- 设置其位置、基础的建筑信息
    self.x = dbase.x;
    self.y = dbase.y;
    self.rid = dbase.rid;
    self.base = SmallBuildingM.find(dbase.class_id);
    
    -- 登记本对象
    if self.rid ~= nil then
        RID.add(self.rid, self);
    end
    
    return self;
end

-- 取得该对象的描述字符串
function SmallBuilding:get_ob_id()
    return string.format("SmallBuilding:%s", tostring(self.rid));   
end

-- 析构函数
function SmallBuilding:destroy()
    if self.rid ~= nil then
        RID.remove(self.rid);
    end
    self = {};
end
